Tomáš Pospíšek's Notizblock

Text to Speech on Linux

TL;DR

Best:

sudo apt-get install libttspico-utils
wget http://what-you-want.to/read.html -O - | htmltotext > /tmp/what-you-want-to-read.txt
pico2wave -w /tmp/what-you-want-to-read.wav "$( cat /tmp/what-you-want-to-read.txt )"
vlc /tmp/what-you-want-to-read.wav

Still too bad quality to be intelligible.

!TL;DR

Not really surprisingly Google's software yields the best result. Thank you Google for the software!!!

However the reading is too fast for that kind of text for me. Let's slow it down:

mpv --af=scaletempo --speed 0.7 /tmp/lookdave.wav

So while I was baking today I was wishing to be able to listen to the text of the Speak Truth To Power study.

apt-get install would be all that it takes right? Well, ... :

I asked DuckDuckGo and it led me to an elinux "RPi Text to Speech" Wiki entry. My takeaway from it:

festival

Old and not so good voice quality - didn't try out.

espeak / mbrola

espeak seems to use mbrola as a backend for improved voice quality. Oh well mbrola, the same software I was trying in what - 2002 ? - with mixed results - is that still the "go to" speech synthesis software today?

Anyway - I went and did try it out. Listening to espeak/mbrola is like listening to someone with speech problems: you kind of understand what the person is talking about, but you really need to ask to please repeat phrases and words except that - you can't do that with espeak.

Now "Speak Truth To Power" is not an easy text. So I tried to tune the output further.

First I tried to distill the voices I understand "best". These are:

english-mb-en1
us-mbrola-2
us-mbrola-1
en-german

You can have espeak use a different voice like this:

espeak -s 120 -v us-mbrola-1 -f "Speak Truth to Power.html"

where the "-s 120" parameter (default is 180) reduces the talking speed. Also you'll need to apt-get install the relevant mbrola speech packages.

The above mentioned "Speak Truth to Power" web page, by the way, was exported by telling Firefox to "Save as" "text". While it's cool that Firefox will then export the page as some kind of markdown, you'll need to edit the text further and remove links and stuff ("slash slash") to make the reading more pleasant.

However the text as spoken by espeak with mbrola is still not really intelligible for my mental decoding capacities.

Google Translate Text to Speak

The "RPi Text to Speech" page above further suggest to try the online Google text to speach translator.

The problem is: I get a "Service Unavailable" from Google. Too bad.

Cepestral

Cepestral is producing closed source commercial TTS software that maybe can be used for free for personal use? The immediate problem with it is that you need to send an email to get a license. Today is sunday, so no license for me today.

I'll see whether I get a reply tomorrow...

Google's Android "Pico Text to Speech" TTS engine

sudo apt-get install libttspico-utils
pico2wave -w lookdave.wav "Look Dave, I can see you're really upset about this." && aplay lookdave.wav

Not really surprisingly Google's software yields the best result. Thank you Google for the software!!!

However the reading is too fast for that kind of text for me. Let's slow it down:

mpv --af=scaletempo --speed 0.7 /tmp/lookdave.wav

If you don't specify "--af=scaletempo" then the pitch of the sound will not get adjusted when slowing down the play-back and you'll get a really low voice.

However the text is still very difficult to understand - I guess english being english and there not being any unambiguous rules about how to pronounce some words the software gets it wrong half of the time.

So it's better to use a GUI to be able to rewind and replay some part of the text.

VLC has GUI controls to both rewind and also to vary the play-back speed (you need to customize the GUI to have the "speed-changing" controls available in your GUI).

So finally that's what I did and still. The software is not able to convey the text to me clearly enough for me to be able to understand it.

Bad luck. If anybody knows of "even better" TTS software for linux then please let me know.

Articles